package edu.nf.utils;

import org.nf.dbhelper.SQLExecutor;

public class SQLExecutorFactory {

    private static ThreadLocal<SQLExecutor> threadLocal = new ThreadLocal<>();

    public static SQLExecutor getSQLExecutor(){
        if(threadLocal.get() == null){
            threadLocal.set(new SQLExecutor(DBUtil.getConnection()));
        }
        return threadLocal.get();
    }

    public static void close(){
        if(threadLocal.get() != null){
            threadLocal.remove();
        }
    }
}
